/* eslint-disable indent */
import moment from 'moment';
import { appendToken } from '@/utils/tool';
class MessageRecord {
	constructor() {
		this.messageRecords = [];
		this.messageRecordMap = new Map();
		this.peerStatusIgnore = ['ready-to-talk', 'reconnecting'];
		this.peerCmd = [];
		this.peerResponse = [];
		this.peerCancel = [];
		this.userInfoMap = new Map();
		this.titleEnum = {
			joined: '加入会话',
			quit: '离开会话',
			failed: '',
			rejected: '',
			'in-progress': '',
			'scan-code': '推送扫码',
			'get-geo-location': '获取位置',
			'fill-form': '推送表单',
			'screen-mark': '共享标注',
			'screen-share': '屏幕共享',
			'transfer-bizscenario': '转接',
			'invite-multiple': '三方',
			'face-idcard-validate': '人证对比',
			'face-recognition': '人脸比对',
			'get-screencapture': '截屏',
			'get-screenshot': '截图',
			page: '推送链接',
			'get-handwriting': '推送签名',
			whiteboard: '共享白板',
			'whiteboard-pdf': '共享PDF',
			'collect-variable': '信息收集',
			'collect-short-video': '短视频采集',
			'bankcard-collection': '卡证采集', //银行卡
			'testimony-write': '证言抄录',
			'start-tts-speaking': 'TTS辅助播报',
			'co-browsing': '同屏辅助',
			'idcard-collection': '卡证采集', //身份证
			'regional-screen': '区域录屏',
			'customer-view-mark': '实时标注'
		};
		this.defaultCustomer = require('@/assets/img/upload/default_customer.png');
		this.defaultAgentAvatar = require('@/assets/img/upload/agent_avatar.png');
		this.defaultRobotAvatar = require('@/assets/img/upload/jiqiren.png');
		this.viewType = '';
	}

	setMessageRecord(messageRecord) {
		if (Array.isArray(messageRecord)) {
			// 1.洗数据
			console.log(messageRecord, '洗数据:');
			messageRecord.map(item => {
				if (!item.fromUserRole && item.fromClientId === 'system' && item.msgType === 'start-recording') {
					// 系统消息 开启双录
				} else {
					this.filterSystemMeassage(item);
				}
			});
		}
		console.log('洗完之后的：', this.messageRecords);
	}
	clearMessageData() {
		this.messageRecords = [];
	}

	//过滤指令信息
	filterRecordMessage() {}
	// 根据类型展示标题
	getMessageTitle(type) {
		let result = '';
		switch (type) {
			case 'peer-cmd':
				result = '请求：';
				break;
			case 'peer-response':
				result = '响应：';
				break;
			case 'peer-cancel':
				result = '取消：';
				break;
			default:
				result = '';
				break;
		}
		return result;
	}
	filterSystemMeassage(data) {
		console.log(data.msgType, data.data.status, data.data.cmd);
		let title = '';
		let text = '';
		if (data.data?.data?.url) {
			data.data.data.url = data.data.data.url.replace('http://', 'https://');
			data.data.data.href = appendToken(data.data.data.url);
		}
		if (data.data?.data?.imageUrl) {
			data.data.data.imageUrl = data.data.data.imageUrl.replace('http://', 'https://');
			data.data.data.href = appendToken(data.data.data.imageUrl);
		}
		if (data.data?.data?.urls) {
			data.data.data.urls.map(item => {
				item.url = item.url.replace('http://', 'https://');
				item.href = appendToken(item.url);
			});
		}
		if (data.data?.data?.data?.url) {
			data.data.data.data.url = data.data.data.data.url.replace('http://', 'https://');
			data.data.data.data.href = appendToken(data.data.data.data.url);
		}
		if (data.data?.data?.data && typeof data.data.data.data === 'string') {
			data.data.data.href = appendToken(data.data.data.data);
		}
		if (data.msgType === 'peer-status') {
			switch (data.data.status) {
				case 'joined':
					if (data.data.clinetWhoInvitateCustomer) {
						this.userInfoMap.set(`${data.data.role}-${data.data.user.name}`, data.data.user);
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.filterTitle(data.data.status),
								toUser: this.filterUserInfo(data.data.clinetWhoInvitateCustomer),
								data: { text: `邀请访客&lt;${data.data.user.name}&gt;加入会话` },
								fromUser: this.filterUserInfo(data.data.clinetWhoInvitateCustomer),
								type: 'system'
							}
						];
					} else {
						this.userInfoMap.set(`${data.data.role}-${data.data.user.name}`, data.data.user);
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: data.data.type === 'force' ? '强插' : this.filterTitle(data.data.status),
								toUser: this.filterUserInfo(data.data),
								data: { text: '加入当前会话' },
								fromUser: this.filterUserInfo(data.data),
								type: 'system'
							}
						];
					}
					break;
				case 'quit':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: data.data.type === 'force' ? '强拆' : this.filterTitle(data.data.status),
							toUser: this.filterUserInfo(data.data),
							data: { text: '离开当前会话' },
							fromUser: this.filterUserInfo(data.data),
							type: 'system'
						}
					];
					if (this.userInfoMap.has(`${data.data.role}-${data.data.user.name}`, data.data.user)) {
						this.userInfoMap.delete(`${data.data.role}-${data.data.user.name}`, data.data.user);
					}
					break;

				default:
					break;
			}
		}
		if (data.msgType === 'peer-cmd') {
			console.log(data, 'peer-cmd');
			switch (data.data.cmd) {
				case 'customer-view-mark':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作: ' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}`
							},
							type: 'request'
						}
					];
					break;
				case 'scan-code':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							},
							type: 'request'
						}
					];
					break;
				case 'get-geo-location':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'fill-form':
					let formName = '';
					if (Array.isArray(data.data.data)) {
						formName = data.data.data.map(form => form.formName).join('、');
					} else {
						formName = data.data.data.formName;
					}
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)} &lt;${formName}&gt;请求`
							}
						}
					];
					break;
				case 'screen-mark':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: '开始共享标注'
							}
						}
					];
					break;
				case 'screen-share':
					// todo
					break;
				case 'face-idcard-validate':
					if (data.data && data.data.data && data.data.data.imageUrl && data.data.data.imageUrl.startsWith('http://')) {
						data.data.data.imageUrl = data.data.data.imageUrl.replace('http', 'https');
						// console.log(data.data.data.imageUrl);
					}
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `对访客 &lt;${data.toUserInfo.userName}&gt; 发起人证比对<br/>
                            <p style="padding-top: 8px;">${
								data.data.data.result === 'no'
									? '对比失败，原因：不是本人'
									: data.data.data.result === 'others'
									? '检测不到人脸'
									: data.data.data.result === 'yes'
									? '比对成功'
									: '比对失败'
							} </p>
                            ${
								data.data && data.data.data && data.data.data.imageUrl
									? `<p style="padding-top: 8px;">对比图片：<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.href} " style="color: #6384fe;">${data.data.data.imageUrl} </a></p>`
									: ''
							}`
							}
						}
					];
					break;
				case 'face-recognition':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `对访客 &lt;${data.toUserInfo.userName}&gt; 发起人脸比对<br/>
                            <p style="padding-top: 8px;"> ${
								data.data.data.result === 'apiError'
									? '对比失败，原因：不是本人'
									: data.data.data.result === 'others'
									? '检测不到人脸'
									: data.data.data.result === 'yes'
									? '比对成功'
									: '比对失败'
							} </p>
                            <p style="padding-top: 8px;">对比图片：<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.imageUrl} " style="color: #6384fe;">${
									data.data.data.imageUrl
								} </a></p>`
							}
						}
					];
					break;
				case 'get-screencapture':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'get-screenshot':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'view':
					if (data && data.data && data.data.data && data.data.data.type === 'page') {
						this.viewType = data.data.data.type;
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.data.type),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送链接<br/>
                                <p style="padding-top: 8px;">链接:<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.url} </a></p>`
								}
							}
						];
					}
					if (data && data.data && data.data.data && data.data.data.type === 'video') {
						this.viewType = data.data.data.type;
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送视频',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送视频<br/>
                                <p style="padding-top: 8px;">视频:<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.url} </a></p>`
								}
							}
						];
						// console.warn(this.messageRecords, 'video');
					}
					if (data && data.data && data.data.data && data.data.data.type === 'paper') {
						this.viewType = data.data.data.type;
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送PDF',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送PDF<br/>
                                <p style="padding-top: 8px;"><span>PDF:</span><a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.name} " style="color: #6384fe;margin-left:5px"">${data.data.data.name} </a></p>`
								}
							}
						];
						// console.warn(this.messageRecords, 'pdf');
					}
					if (data && data.data && data.data.data && data.data.data.type === 'richtext') {
						this.viewType = data.data.data.type;
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送富文本',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送富文本<br/>
                                推送富文本内容:`
								},
								type: 'richtext',
								link: data.data.data.data
							}
						];
						// console.warn(data, 'richtext', this.messageRecords);
					}
					// knowledgeBase
					if (data && data.data && data.data.data && data.data.data.type === 'knowledgeBase') {
						if (data.data.data.subType === 'video') {
							this.viewType = data.data.data.type;
							this.messageRecords = [
								...this.messageRecords,
								{
									id: data.id,
									createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
									title: this.getMessageTitle(data.msgType) + '推送知识库',
									fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
									toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
									data: {
										text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送知识库<br/>
									<p style="padding-top: 8px;">视频: <a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.name} </a></p>`
									}
								}
							];
						} else if (data.data.data.subType === 'pdf') {
							this.viewType = data.data.data.type;
							this.messageRecords = [
								...this.messageRecords,
								{
									id: data.id,
									createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
									title: this.getMessageTitle(data.msgType) + '推送知识库',
									fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
									toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
									data: {
										text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送知识库<br/>
									<p style="padding-top: 8px;"><span>PDF:</span><a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.name} " style="color: #6384fe;margin-left:5px"">${data.data.data.name} </a></p>`
									}
								}
							];
						} else if (data.data.data.subType === 'text') {
							this.viewType = data.data.data.type;
							this.messageRecords = [
								...this.messageRecords,
								{
									id: data.id,
									createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
									title: this.getMessageTitle(data.msgType) + '推送知识库',
									fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
									toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
									data: {
										text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送知识库<br/>
									富文本内容:`
									},
									type: 'richtext',
									link: data.data.data.data
								}
							];
						} else if (data.data.data.subType === 'image') {
							this.viewType = data.data.data.type;
							this.messageRecords = [
								...this.messageRecords,
								{
									id: data.id,
									createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
									title: this.getMessageTitle(data.msgType) + '推送知识库',
									fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
									toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
									data: {
										text: `向访客 &lt;${data.toUserInfo.userName}&gt; 推送知识库<br/>
									<p style="padding-top: 8px;"><span>图片:</span><a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.name} " style="color: #6384fe;margin-left:5px"">${data.data.data.name} </a></p>`
									}
								}
							];
						}
					}

					break;
				case 'get-handwriting':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'whiteboard':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}`
							}
						}
					];
					break;
				case 'whiteboard-pdf':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}<br/>
                            <p style="padding-top: 8px;"><span>PDF:</span><a target="_blank" href='${data.data.data.data.href} ' v-html="${
									data.data.data.data.name
								} " style="color: #6384fe; margin-left:5px">${data.data.data.data.name} </a></p>`
							}
						}
					];
					break;
				case 'collect-variable':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'collect-short-video':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'bankcard-collection':
					title = this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd);
					text = `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`;
					if (data.data.data?.autoOcr) {
						title = title + '+OCR识别请求';
						text = text + '+OCR识别请求';
					}
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: title,
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: text
							}
						}
					];
					break;
				case 'testimony-write':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`
							}
						}
					];
					break;
				case 'co-browsing':
					if (data && data.data && data.data.data.type !== 'request-customer-size') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: '坐席操作：' + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}`
								}
							}
						];
						// console.warn(data, 'co-browsing');
					}
					break;
				case 'idcard-collection':
					title = this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd);
					text = `向访客 &lt;${data.toUserInfo.userName}&gt; 发起${this.filterTitle(data.data.cmd)}请求`;
					if (data.data.data?.autoOcr) {
						title = title + '+OCR识别请求';
						text = text + '+OCR识别请求';
					}
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: title,
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: text
							}
						}
					];
					break;
				default:
					break;
			}
		}
		if (data.msgType === 'peer-response') {
			switch (data.data.cmd) {
				case 'scan-code':
					if (data.data.status === 'done') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致&lt; 坐席${data.toUserInfo.userName} &gt;，扫码成功，扫码结果：${data.data.data.code}`
								},
								type: 'response'
							}
						];
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，扫码失败，原因：访客拒绝`
								}
							}
						];
					}
					break;
				case 'get-geo-location':
					if (data.data.status === 'done') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，获取成功，地理位置：${data.data.data.address}`
								}
							}
						];
					}
					if (data.data.status === 'rejected' || data.data.status === 'failed') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，获取失败，原因：访客拒绝`
								}
							}
						];
					}
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，获取失败，原因：访客提交超时`
								}
							}
						];
					}
					break;
				case 'fill-form':
					if (data.data.status === 'done') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交成功`
								}
							}
						];
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，获取失败，原因：访客提交超时`
								}
							}
						];
					}
					break;
				case 'get-screencapture':
					if (data.data.status === 'done') {
						if (data.data && data.data.data && data.data.data.url && data.data.data.url.startsWith('http://')) {
							data.data.data.url = data.data.data.url.replace('http', 'https');
							console.log(data.data, 999);
						}
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，截屏成功 <br/>
                                <p style="padding-top: 8px;">截屏链接:<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.url} </a></p>`
								}
							}
						];
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '截屏',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
								}
							}
						];
					}
					break;
				case 'get-screenshot':
					if (data.data.status === 'done') {
						if (data.data && data.data.data && data.data.data.url && data.data.data.url.startsWith('http://')) {
							data.data.data.url = data.data.data.url.replace('http', 'https');
						}
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，截图成功 <br/>
                                <p style="padding-top: 8px;">截图链接：<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.url} </a></p>`
								}
							}
						];
					}
					if (data.data.status === 'failed') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，截图失败:超时 <br/>`
								}
							}
						];
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '截图',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
								}
							}
						];
					}
					break;
				case 'view':
					if (data && data.data && data.data.status === 'done' && this.viewType === 'page') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送链接',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收成功`
								}
							}
						];
						// console.warn(data, 'page', this.viewType);
					}
					if (data && data.data && data.data.status === 'done' && this.viewType === 'video') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送视频',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收成功`
								}
							}
						];
						// console.warn(data, 'video');
					}
					if (data && data.data && data.data.status === 'done' && this.viewType === 'paper') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送PDF',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收成功`
								}
							}
						];
						// console.warn(data, 'paper');
					}
					if (data && data.data && data.data.status === 'done' && this.viewType === 'richtext') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送富文本',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收成功`
								}
							}
						];
						// console.warn(data, 'richtext');
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected' && this.viewType === 'page') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送链接',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
								}
							}
						];
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected' && this.viewType === 'video') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送链接',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
								}
							}
						];
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected' && this.viewType === 'paper') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送链接',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
								}
							}
						];
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected' && this.viewType === 'richtext') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + '推送链接',
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
								}
							}
						];
					}
					// knowledgeBase
					if (data && data.data && data.data.data && data.data.status === 'done' && data.data.data.type === 'knowledgeBase') {
						if (['video', 'pdf', 'text', 'image'].includes(data.data.data.subType)) {
							this.messageRecords = [
								...this.messageRecords,
								{
									id: data.id,
									createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
									title: this.getMessageTitle(data.msgType) + '推送知识库',
									fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
									toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
									data: {
										text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收成功`
									}
								}
							];
						}
					}
					if (data && data.data && data.data.data && data.data.data.reason === 'auto-rejected' && data.data.data.type === 'knowledgeBase') {
						if (['video', 'pdf', 'text', 'image'].includes(data.data.data.subType)) {
							this.messageRecords = [
								...this.messageRecords,
								{
									id: data.id,
									createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
									title: this.getMessageTitle(data.msgType) + '推送知识库',
									fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
									toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
									data: {
										text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;接收失败，原因：访客正在进行其他指令`
									}
								}
							];
						}
					}
					break;
				case 'get-handwriting':
					if (data.data.status === 'done') {
						if (data.data && data.data.data && data.data.data.url && data.data.data.url.startsWith('http://')) {
							data.data.data.url = data.data.data.url.replace('http', 'https');
						}
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交成功 <br/>
                                <p style="padding-top: 8px;"> 签名：<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.name} </a></p>
                                `
								}
							}
						];
						// console.warn('get-handwriting:', this.messageRecords, data);
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，推送表单请求，原因：访客提交超时`
								}
							}
						];
					}
					break;
				case 'collect-variable':
					if (data.data.status === 'done') {
						let variables = data.data.data.data ? data.data.data.data : data.data.data;
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交成功,<br/>
                                ${variables
									.map(item => {
										console.log(item);
										return `&lt;<span>${item.name}</span>&gt; : &lt;<span>${item.value}</span>&gt;<br/>`;
									})
									.join('')}
                                `
								}
							}
						];
						console.warn(data.data.data.data);
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，的信息收集请求，原因：访客提交超时`
								}
							}
						];
					}
					break;
				case 'collect-short-video':
					if (data.data.status === 'done') {
						if (data.data && data.data.data && data.data.data.url && data.data.data.url.startsWith('http://')) {
							data.data.data.url = data.data.data.url.replace('http', 'https');
						}
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致&lt; 坐席${data.toUserInfo.userName} &gt;，提交成功，短视频链接：<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.url} " style="color: #6384fe;">${data.data.data.url} </a>`
								},
								type: 'response'
							}
						];
					}
					if (data.data.status === 'rejected' && data.data.data.reason !== 'record-crash') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					if (data.data.data.reason === 'record-crash') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：拍摄异常中断`
								}
							}
						];
					}
					break;
				case 'bankcard-collection':
					if (data.data.status === 'done') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致&lt; 坐席${data.toUserInfo.userName} &gt;，提交成功，银行卡正面 ：<a target="_blank" href='${data.data.data.urls[0].href} ' v-html="${data.data.data.urls[0].url} " style="color: #6384fe;">${data.data.data.urls[0].url} </a>`
								}
							}
						];
						console.warn(data.data.data, 'urls.url');
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					break;
				case 'testimony-write':
					if (data.data.status === 'done') {
						if (data.data && data.data.data && data.data.data.data && data.data.data.data.startsWith('http://')) {
							data.data.data.data = data.data.data.data.replace('http', 'https');
						}
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致&lt; 坐席${data.toUserInfo.userName} &gt;，提交成功，抄录图片 ：<a target="_blank" href='${data.data.data.href} ' v-html="${data.data.data.data} " style="color: #6384fe;">${data.data.data.data} </a>`
								}
							}
						];
						console.warn(data.data.data, 'urls.url');
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					break;
				case 'idcard-collection':
					if (data.data.status === 'done') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致&lt; 坐席${data.toUserInfo.userName} &gt;，提交成功，
                                身份证正面 ：<a target="_blank" href='${data.data.data.urls[0].href} ' v-html="${data.data.data.urls[0].url} " style="color: #6384fe;">${data.data.data.urls[0].url} </a> <br/>
                                <p style="margin-left:154px;padding-top:8px">身份证反面 ：
                                <a target="_blank" href='${data.data.data.urls[1].href} ' v-html="${data.data.data.urls[1].url} " style="color: #6384fe;">${data.data.data.urls[1].url} </a></p>
                                `
								}
							}
						];
						console.warn(data.data.data, 'urls.url');
					}
					if (data.data.status === 'rejected') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `致 &lt; 坐席${data.toUserInfo.userName} &gt;，提交失败，原因：访客拒绝`
								}
							}
						];
					}
					break;
				default:
					break;
			}
		}
		if (data.msgType === 'peer-cancel') {
			switch (data.data.cmd) {
				case 'scan-code':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的推送扫码请求,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的推送扫码请求`
								},
								type: 'cancel'
							}
						];
					}
					break;
				case 'get-geo-location':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的获取位置请求,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的获取位置请求`
								}
							}
						];
					}
					break;
				case 'fill-form':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的推送表单请求,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的推送表单请求`
								}
							}
						];
					}
					break;
				case 'screen-mark':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: '停止共享标注'
							}
						}
					];
					break;
				case 'customer-view-mark':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `结束访客 &lt; ${data.toUserInfo.userName} &gt; 的${this.filterTitle(data.data.cmd)}`
							}
						}
					];
					break;
				case 'get-handwriting':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的推送签名请求,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的推送签名请求`
								}
							}
						];
					}
					break;
				case 'whiteboard':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: ` 结束访客 &lt; ${data.toUserInfo.userName} &gt; 的共享白板`
							}
						}
					];
					break;
				case 'whiteboard-pdf':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: '坐席操作：' + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `结束访客 &lt; ${data.toUserInfo.userName} &gt; 的共享PDF`
							}
						}
					];
					break;
				case 'collect-variable':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的信息收集请求，原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的信息收集请求`
								}
							}
						];
					}
					break;
				case 'collect-short-video':
					this.messageRecords = [
						...this.messageRecords,
						{
							id: data.id,
							createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
							title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
							fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
							toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
							data: {
								text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的短视频采集请求${data.data.reason === 'timeout' ? '，原因：访客提交超时' : ''}`
							}
						}
					];
					break;
				case 'bankcard-collection':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的卡证采集,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的卡证采集`
								}
							}
						];
					}
					break;
				case 'testimony-write':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的证言抄录请求,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的证言抄录请求`
								}
							}
						];
					}
					break;
				case 'idcard-collection':
					if (data.data.reason === 'timeout') {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的卡证采集,原因：访客提交超时`
								}
							}
						];
					} else {
						this.messageRecords = [
							...this.messageRecords,
							{
								id: data.id,
								createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
								title: this.getMessageTitle(data.msgType) + this.filterTitle(data.data.cmd),
								fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
								toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
								data: {
									text: `取消访客 &lt; ${data.toUserInfo.userName} &gt; 的卡证采集`
								}
							}
						];
					}
					break;
				case 'screen-share':
					break;
				default:
					break;
			}
		}
		if (data.msgType === 'screen-share') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：屏幕共享',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `向访客 &lt; ${data.toUserInfo.userName} &gt; 发起屏幕共享`
					}
				}
			];
		}
		if (data.msgType === 'stop-screen-share') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：屏幕共享',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `结束访客 &lt; ${data.toUserInfo.userName} &gt; 的屏幕共享`
					}
				}
			];
		}
		if (data.msgType === 'screen-record') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：录屏',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: '开始录屏'
					}
				}
			];
			// console.warn(this.messageRecords, ' this.messageRecords');
		}
		if (data.msgType === 'stop-screen-record') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：录屏',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: '停止录屏'
					}
				}
			];
		}
		// 转接逻辑
		if (data.msgType === 'invite' && data.data && data.data.type !== 'invite-multiple' && data.data.type !== 'invite-multiple-human' && !data.invitation) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '转接',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `发起转接到业务场景 &lt; ${data.data.bizSceneName} &gt; 坐席 ${data.data.agentId.includes('*') ? '' : ` &lt; ${data.data.agentId}&gt;`} `
					}
				}
			];
			console.log('transfer', data);
		}
		if (data.msgType === 'invite' && data.invitation && data.invitation.failReason !== '' && data.data && data.data.type !== 'invite-multiple' && data.data.type !== 'invite-multiple-human') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '转接',
					fromUser:
						data.invitation && data.invitation.failReason !== '' && data.data.type === 'transfer-bizscenario' && data.fromUserRole === 'agent'
							? { name: `坐席${data.fromUserName}`, picture: this.defaultAgentAvatar }
							: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `转接失败，原因：${this.getAgentStatus(data.invitation.failReason)}`
					}
				}
			];
			// console.log(data.invitation, 'invite :???');
		}

		// 三方逻辑
		if (data.msgType === 'invite' && data.data && data.data.type === 'invite-multiple' && !data.invitation) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '三方',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `邀请业务场景 &lt; ${data.data.bizSceneName} &gt; 坐席 ${data.data.agentId.includes('*') ? '' : ` &lt; ${data.data.agentId}&gt;`} 加入会话`
					}
				}
			];
		}
		if (data.msgType === 'invite' && data.data && data.data.type === 'invite-multiple' && data.invitation && data.invitation.failReason) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '三方',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `邀请失败，原因：${this.getAgentStatus(data.invitation.failReason)}`
					}
				}
			];
			console.warn(data.invitation, 'invitation-multiple :???');
		}
		// 邀请人工三方
		if (data.msgType === 'invite' && data.data && data.data.type === 'invite-multiple-human' && !data.invitation) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '邀请人工三方',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `邀请业务场景 &lt; ${data.data.bizSceneName} &gt; 坐席 ${data.data.agentId.includes('*') ? '' : ` &lt; ${data.data.agentId}&gt;`} 加入会话`
					}
				}
			];
			console.warn('invite-multiple-human:', data.invitation);
		}
		if (data.msgType === 'invite' && data.data && data.data.type === 'invite-multiple-human' && data.invitation && data.invitation.failReason) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '邀请人工三方',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `邀请失败，原因：${this.getAgentStatus(data.invitation.failReason)}`
					}
				}
			];
			console.warn(data.invitation, 'invitation-multiple-human :???');
		}
		if (data.msgType === 'ocr' && data.data.type === 'bankcard' && data.data.status === 'done') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '系统操作：OCR识别',
					// fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.toUserInfo.userName}&gt;上传的银行卡照片进行OCR识别<br/>
                    <p style="padding-top: 8px;">识别成功</p>
                    <p style="padding-top: 8px;">识别结果：</p>
                    <p style="padding-top: 8px;">卡片类型：${data.data.result.cardType} </p>
                    <p style="padding-top: 8px;">卡号：${data.data.result.cardNumber}</p>
                    <p style="padding-top: 8px;">银行：${data.data.result.bankName} </p>
                    <p style="padding-top: 8px;">有效期：${data.data.result.validToDate}</p>
                    `
					}
				}
			];
		}
		if (data.msgType === 'ocr' && data.data.type === 'bankcard' && data.data.status === 'failed') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '系统操作：OCR识别',
					// fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.toUserInfo.userName}&gt;上传的银行卡照片进行OCR识别<br/>
                    <p style="padding-top: 8px;">识别失败</p>
                    `
					}
				}
			];
		}
		if (data.msgType === 'ocr' && data.data.type === 'idcard' && data.data.status === 'done' && data.data.result.name) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '系统操作：OCR识别',
					// fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.toUserInfo.userName}&gt;上传的身份证人像面照片进行OCR识别<br/>
                    <p style="padding-top: 8px;">识别成功</p>
                    <p style="padding-top: 8px;">识别结果：</p>
                    <p style="padding-top: 8px;">公民身份证号码：${data.data.result.idNumber} </p>
                    <p style="padding-top: 8px;">姓名：${data.data.result.name}</p>
                    <p style="padding-top: 8px;">性别：${data.data.result.sex} </p>
                    <p style="padding-top: 8px;">民族：${data.data.result.ethnicity}</p>
                    <p style="padding-top: 8px;">住址：${data.data.result.address}</p>
                    <p style="padding-top: 8px;">出生日期：${data.data.result.birthDate}</p>
                    `
					}
				}
			];
		}
		if (data.msgType === 'ocr' && data.data.type === 'idcard' && data.data.status === 'done' && (data.data.result.issueAuthority || data.data.result.validPeriod)) {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '系统操作：OCR识别',
					// fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.toUserInfo.userName}&gt;上传的身份证国徽面照片进行OCR识别<br/>
                    <p style="padding-top: 8px;">识别成功</p>
                    <p style="padding-top: 8px;">识别结果：</p>
                    <p style="padding-top: 8px;">签发机关：${data.data.result.issueAuthority} </p>
                    <p style="padding-top: 8px;">有效期限：${data.data.result.validPeriod}</p>
                    `
					}
				}
			];
		}
		if (data.msgType === 'ocr' && data.data.type === 'idcard' && data.data.status === 'failed' && data.data.side === 'face') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '系统操作：OCR识别',
					// fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.toUserInfo.userName}&gt;上传的身份证人像面照片进行OCR识别<br/>
                    <p style="padding-top: 8px;">识别失败</p>
                    `
					}
				}
			];
		}
		if (data.msgType === 'ocr' && data.data.type === 'idcard' && data.data.status === 'failed' && data.data.side === 'back') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '系统操作：OCR识别',
					// fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.toUserInfo.userName}&gt;上传的身份证国徽面照片进行OCR识别<br/>
                    <p style="padding-top: 8px;">识别失败</p>
                    `
					}
				}
			];
		}
		if (data.msgType === 'start-tts-speaking') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：TTS辅助播报',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: ` 发起TTS辅助播报<br/>
                    <p style="padding-top: 8px;">播报内容：</p>
                    <div style="padding-top: 8px;word-break: break-word;line-height: 20px;">${data.data}</div>
                    `
					}
				}
			];
		}
		if (data.msgType === 'cancel-tts-speaking') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：TTS辅助播报',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: '取消辅助播报'
					}
				}
			];
		}
		if (data.msgType === 'ai-checkout' && data.data.status === 'compare-face') {
			if (data.data && data.data && data.data.request && data.data.request.capturedImg && data.data.request.capturedImg.url && data.data.request.capturedImg.url.startsWith('http://')) {
				data.data.request.capturedImg.url = data.data.request.capturedImg.url.replace('http', 'https');
			}
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：人脸比对',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.data.customerClient.user.name}&gt; 发起人脸比对<br/>
                    <p style="padding-top: 8px;">${data.data.response === 'no' ? '对比失败，原因：不是本人' : data.data.response === 'others' ? '检测不到人脸' : '对比成功'} </p>
                    ${
						data.data && data.data && data.data.request && data.data.request.capturedImg && data.data.request.capturedImg.url
							? `<p style="padding-top: 8px;">对比图片：<a target="_blank" href='${data.data.request.capturedImg.url} ' v-html="${data.data.request.capturedImg.url} " style="color: #6384fe;">${data.data.request.capturedImg.url} </a></p>`
							: ''
					}
                    `
					}
				}
			];
			// console.log(data.data.request, 'request');
		}
		if (data.msgType === 'ai-checkout' && data.data.status === 'match-idCard-face') {
			if (data.data && data.data && data.data.request && data.data.request.capturedImg && data.data.request.capturedImg.url && data.data.request.capturedImg.url.startsWith('http://')) {
				data.data.request.capturedImg.url = data.data.request.capturedImg.url.replace('http', 'https');
			}
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '坐席操作：人证比对',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					data: {
						text: `对访客 &lt;${data.data.customerClient.user.name}&gt; 发起人证比对<br/>
                    <p style="padding-top: 8px;">${data.data.response === 'no' ? '对比失败，原因：不是本人' : data.data.response === 'others' ? '检测不到人脸' : '对比成功'} </p>
                    ${
						data.data && data.data && data.data.request && data.data.request.capturedImg && data.data.request.capturedImg.url
							? `<p style="padding-top: 8px;">对比图片：<a target="_blank" href='${data.data.request.capturedImg.url} ' v-html="${data.data.request.capturedImg.url} " style="color: #6384fe;">${data.data.request.capturedImg.url} </a></p>`
							: ''
					}
                    `
					}
				}
			];
			// console.warn(data.data.request.capturedImg.url);
		}
		if (data.msgType === 'start-recording') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: data.data.type === 'system' ? '坐席操作：双录' : '坐席操作：区域录屏',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: data.data.type === 'system' ? '' : this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: data.data.type === 'system' ? `开始双录` : `开始区域录屏`
					}
				}
			];
		}
		if (data.msgType === 'stop-recording') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: data.data.type === 'system' ? '坐席操作：双录' : '坐席操作：区域录屏',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: data.data.type === 'system' ? '' : this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: data.data.type === 'system' ? `停止双录` : `停止区域录屏`
					}
				}
			];
		}
		// 语音会话
		if (data.msgType === 'request-upgrade' && data?.data?.media == 'audio') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '请求：IM会话升级语音会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `向 ${data?.fromUserRole === 'customer' ? '坐席' : '访客'} &lt; ${data.toUserInfo.userName} &gt; 发起升级语音会话请求`
					}
				}
			];
		}
		if (data.msgType === 'accept-upgrade' && data?.data?.media == 'audio') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '响应：IM会话升级语音会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `接受请求`
					}
				}
			];
		}
		if (data.msgType === 'reject-upgrade' && data?.data?.media == 'audio') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '响应：IM会话升级语音会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `拒绝请求`
					}
				}
			];
		}
		if (data.msgType === 'cancel-upgrade' && data?.data?.reason == 'normal' && data?.data?.media == 'audio') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '取消：IM会话升级语音会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `取消向 ${data?.fromUserRole === 'customer' ? '坐席' : '访客'} &lt; ${data.toUserInfo.userName} &gt; 发起升级语音会话请求`
					}
				}
			];
		}

		// 视频会话
		if (data.msgType === 'request-upgrade' && data?.data?.media == 'video') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '请求：IM会话升级视频会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `向 ${data?.fromUserRole === 'customer' ? '坐席' : '访客'}&lt; ${data.toUserInfo.userName} &gt; 发起升级视频会话请求`
					}
				}
			];
		}
		if (data.msgType === 'accept-upgrade' && data?.data?.media == 'video') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '响应：IM会话升级视频会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `接受请求`
					}
				}
			];
		}
		if (data.msgType === 'reject-upgrade' && data?.data?.media == 'video') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '响应：IM会话升级视频会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `拒绝请求`
					}
				}
			];
		}
		if (data.msgType === 'cancel-upgrade' && data?.data?.reason == 'normal' && data?.data?.media == 'video') {
			this.messageRecords = [
				...this.messageRecords,
				{
					id: data.id,
					createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
					title: '取消：IM会话升级视频会话',
					fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
					toUser: this.getUserInfoWithMap(`${data.toUserInfo.role}-${data.toUserInfo.userName}`),
					data: {
						text: `取消向 ${data?.fromUserRole === 'customer' ? '坐席' : '访客'} &lt; ${data.toUserInfo.userName} &gt; 发起升级视频会话请求`
					}
				}
			];
		}
		if (data.msgType === 'custom') {
			if (data.data?.businessType === 'notice_media_progress') {
				const status = data.data?.status;
				let text;
				if (status === 'idle') {
					text = '初始化中...';
				} else if (status === 'joining') {
					text = '正在加入房间中...';
				} else if (status === 'permission') {
					text = '摄像头授权中...';
				} else if (status === 'publish') {
					text = '推送画面中...';
				}
				this.messageRecords = [
					...this.messageRecords,
					{
						id: data.id,
						createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
						title: `${data?.fromUserRole === 'customer' ? '访客' : '坐席'}状态`,
						fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
						toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
						data: {
							text: text
						}
					}
				];
			}
			if (data.data?.businessType === 'save-screenshot') {
				this.messageRecords = [
					...this.messageRecords,
					{
						id: data.id,
						createdAt: moment(data.createdAt).format('YYYY-MM-DD HH:mm:ss'),
						title: `${data?.fromUserRole === 'customer' ? '访客' : '坐席'}操作`,
						fromUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
						toUser: this.getUserInfoWithMap(`${data.fromUserInfo.role}-${data.fromUserInfo.userName}`),
						data: {
							text: `坐席手动截图成功 <br/>
                                <p style="padding-top: 8px;">截图链接：<a target="_blank" href='${data.data.url} ' v-html="${data.data.url} " style="color: #6384fe;">${data.data.url} </a></p>`
						}
					}
				];
			}
		}
	}
	filterTitle(status) {
		// console.log(status, this.titleEnum);
		return this.titleEnum[status];
	}
	filterUserInfo(data) {
		let user = { ...data.user, ...data.user.profile, role: data.role };
		if (user.profile) {
			delete user.profile;
		}
		if (user.role === 'customer' && !user.picture) {
			user.picture = this.defaultCustomer;
		}
		if (user.role === 'agent' && !user.picture) {
			if (user.isRobot) {
				user.picture = this.defaultRobotAvatar;
			} else {
				user.picture = this.defaultAgentAvatar;
			}
		}

		if (user.role === 'customer' && user.name) {
			user.name = `访客${user.name}`;
		}
		if (user.role === 'agent' && user.name) {
			user.name = `坐席${user.name}`;
		}
		// console.log(user, 'filterUserInfo');
		return user;
	}
	getUserInfoWithMap(key) {
		// console.log('key', key);
		if (this.userInfoMap.has(key)) {
			this.userInfoMap.get(key);
			let user = this.userInfoMap.get(key);
			// console.warn(user, key.split('-')[0], 'getUserInfoWithMap:');
			return this.filterUserInfo({ user, role: key.split('-')[0] });
		}
	}
	getAgentStatus(status) {
		// console.warn('getAgentStatus:坐席', status);
		let result = '';
		switch (status) {
			case 'canceled':
				result = '坐席取消邀请';
				break;
			case 'notfound':
				result = '无坐席在线';
				break;
			case 'timeout':
				result = '坐席呼叫超时';
				break;
			case 'offday':
				result = '坐席不在工作日';
				break;
			case 'offtime':
				result = '坐席不在工作时间';
				break;
			case 'scenariodisabled':
				result = '业务场景未启用';
				break;
			case 'otherCustomerAccept':
				result = '其他坐席已经接听';
				break;
			case 'multiCustomerForbidAI':
				result = '指定机器人呼叫时会话中存在多访客';
				break;
			case 'rejected':
				result = '坐席拒绝';
				break;
			case 'ringingTimeout':
				result = '振铃超时未接听';
				break;
			default:
				result = '';
				break;
		}
		return result;
	}
}

const MsgRecord = new MessageRecord();
export default MsgRecord;
